package com.llh.demo4shiro.controller;

import org.apache.shiro.authz.AuthorizationException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.ModelAndView;

/**
 * <p>CreatedAt: 2020/9/18 13:31</p>
 *
 * @author llh
 */
@ControllerAdvice
public class ExpHandler {
    @ExceptionHandler(AuthorizationException.class)
    public ModelAndView authorizationException(AuthorizationException e) {
        ModelAndView mv = new ModelAndView();
        mv.setViewName("error");
        mv.addObject("msg", "权限不足");
        return mv;
    }
}
